import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/Home.vue')
  },
  {
    path: '/vue3',
    name: 'vue3',
    component: () => import('@/views/Vue3.vue')
  },
  {
    path: '/pro',
    name: 'pro',
    component: () => import('@/views/pro/Index.vue'),
    children: [
      {
        path: 'list',
        name: 'proList',
        component: () => import('@/views/pro/List.vue')
      },
      {
        path: 'recommend',
        name: 'recommendList',
        component: () => import('@/views/pro/Recommend.vue')
      },
      {
        path: 'seckill',
        name: 'seckillList',
        component: () => import('@/views/pro/Seckill.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
